package com.hongxun.design.bean;

import android.view.View;

import com.hongxun.design.listeners.ListenerSet;
import com.hongxun.design.mytools.MString;
import com.hongxun.design.utils.StringUtil;

import java.io.File;

/**
 * Created by zerdoor_pc on 2016/5/11.
 * 拍照界面——照片属性
 */
public class PhotoBean {
    private String photo_url = "";
    private int Type;//编辑类型（3种）
    private View.OnClickListener listener;
    public String photo_id;
    public String uuid;
    public String exploration_id;
    public String flag= MString.add;
    public String photo_type;
    public String photo_thumb;
    private String create_time;

    public String getExploration_id() {
        return exploration_id;
    }

    public void setExploration_id(String exploration_id) {
        this.exploration_id = exploration_id;
    }

    public String getPhoto_id() {
        return photo_id;
    }

    public void setPhoto_id(String photo_id) {
        this.photo_id = photo_id;
    }

    public String getPhoto_type() {
        return photo_type;
    }

    public void setPhoto_type(String photo_type) {
        this.photo_type = photo_type;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public String getPhoto_thumb() {
        if (photo_thumb == null || photo_thumb.length() == 0) {
            photo_thumb = photo_url;
        }
        return photo_thumb;
    }

    public void setPhoto_thumb(String photo_thumb) {
        this.photo_thumb = photo_thumb;
    }

    public PhotoBean(int type, View.OnClickListener listener, BackPhoto_Bean data) {
        Type = type;
        this.listener = listener;
        if (data != null) {
            photo_id = data.photo_id;
            photo_type = data.photo_type;
            photo_url = data.photo_url;
            photo_thumb = data.photo_thumb;
            exploration_id=data.getExploration_id();
            flag = data.getFlag();
            uuid = data.getUuid();
            if (!photo_url.contains(File.separator)&& !StringUtil.isEmpty(photo_thumb)){
                photo_url=photo_thumb;
            }
        }

        if (listener == null && photo_url != null && photo_url.length() != 0&&!flag.equals(MString.del)) {
            this.listener = ListenerSet.getPhotoGrapImageClickListener(type, this);
        }

    }

    public PhotoBean(int type, View.OnClickListener listener, String photo_url) {
        Type = type;
        this.listener = listener;
        this.photo_url = photo_url;
        if (listener == null && photo_url != null && photo_url.length() != 0) {
            this.listener = ListenerSet.getPhotoGrapImageClickListener(type, this);
        }

    }

    public PhotoBean(int type, View.OnClickListener listener, String photo_thumb,String photo_url, String photo_id,String uuid, String flag,String exploration_id,String create_time) {
        Type = type;
        this.listener = listener;
        this.photo_url = photo_url;
        this.photo_thumb = photo_thumb;
        this.create_time = create_time;
        this.photo_id = photo_id;
        this.uuid = uuid;
        this.exploration_id = exploration_id;
        this.flag = flag;
        if (listener == null && photo_url != null && photo_url.length() != 0) {
            this.listener = ListenerSet.getPhotoGrapImageClickListener(type, this);
        }

    }

    public String getUrl() {
        return photo_url;
    }

    public void setUrl(String url) {
        this.photo_url = url;
    }

    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    public View.OnClickListener getListener() {
        return listener;
    }

    public void setListener(View.OnClickListener listener) {
        this.listener = listener;
    }
}
